package com.aaa.cars.controller;

import com.aaa.cars.entity.BaseArea;
import com.aaa.cars.service.BaseAreaService;
import com.aaa.common.constants.ReturnStatus;
import com.aaa.common.util.Result;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 统一地区库(BaseArea)表控制层
 *
 * @author makejava
 * @since 2020-12-07 20:25:50
 */
@RestController
@RequestMapping("baseArea")
public class BaseAreaController {
    /**
     * 服务对象
     */
    @Resource
    private BaseAreaService baseAreaService;


    /**
     * 查询所有分页加条件查询
     *
     * @param baseArea 实体
     * @return Result
     */
    @PostMapping("queryAll")
    @ApiOperation("查询所有分页加条件查询")
    public Result queryAll(@RequestBody BaseArea baseArea) {
        return this.baseAreaService.queryAll(baseArea);
    }

    /**
     * 根据地区编号查询地区
     * @param baseAreaid
     * @return
     */
    @PostMapping("queryAllByBaseAreaid")
    public Result queryAllByBaseAreaid(Integer baseAreaid) {
        return this.baseAreaService.queryAllByBaseAreaid(baseAreaid);
    }

    @PostMapping("queryAllByParentid")
    public Result queryAllByParentid(Integer parentid) {
        return this.baseAreaService.queryAllByParentid(parentid);
    }

    /**
     * 将全部市级地区名传到前端显示
     * @return
     */
    @PostMapping("queryAllCity")
    public Result queryAllCity() {
        return this.baseAreaService.queryAllCity();
    }

    /**
     * 将全部县级地区名传到前端
     * @return
     */
    @PostMapping("queryAllArea")
    public Result queryAllArea() {
        return this.baseAreaService.queryAllArea();
    }
}